#include "cv_base_image.h"
#include "cvx_image/cvx_image.h"

CvBaseImage::CvBaseImage()
{
	m_orgImage  = NULL;
}
CvBaseImage::~CvBaseImage()
{
	if (m_orgImage)
	{
		cvReleaseImage(&m_orgImage);
	}
}

bool CvBaseImage::loadImage(char* fileName)
{
	assert(fileName);
	m_orgImage = cvLoadImage(fileName, 1);
	assert(m_orgImage);

	m_width = m_orgImage->width;
	m_height = m_orgImage->height;
	return true;
}
bool CvBaseImage::loadImage(IplImage *image)
{
	assert(image);
	m_orgImage = cvCreateImage(cvGetSize(image), image->depth, image->nChannels);
	assert(m_orgImage);
	cvCopy(image, m_orgImage, NULL);
	m_width = m_orgImage->width;
	m_height = m_orgImage->height;
	return true;
}